<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html">
<html>
<head>
<title>购物车</title>
<jsp:include page="./include/header.jsp"></jsp:include>
</head>
<body>
<jsp:include page="./include/head.jsp"></jsp:include>
<jsp:include page="./include/banner.jsp"></jsp:include>
<!-- contact -->
		<div class="check-out">	 
		<div class="container">	 
	 
				<script>$(document).ready(function(c) {
					$('.close1').on('click', function(c){
						$('.cross').fadeOut('slow', function(c){
							$('.cross').remove();
						});
						});	  
					});
			   </script>
			<script>$(document).ready(function(c) {
					$('.close2').on('click', function(c){
						$('.cross1').fadeOut('slow', function(c){
							$('.cross1').remove();
						});
						});	  
					});
			   </script>	
			   <script>$(document).ready(function(c) {
					$('.close3').on('click', function(c){
						$('.cross2').fadeOut('slow', function(c){
							$('.cross2').remove();
						});
						});	  
					});
			   </script>	
 
<table class="table animated wow fadeInLeft" data-wow-delay=".5s">		   
		  <tr>
			<th class="t-head ">商品</th>
			<th class="t-head">商品名</th>
			<th class="t-head">商品编号</th>
			<th class="t-head">单价</th>
			<th class="t-head">折扣价</th>
			<th class="t-head">数量</th>
			<th class="t-head">总价</th>
		  </tr>
		  <c:forEach items="${goods}" var="g">	
		  <tr class="cross">
			<td class="t-data">
				<a href="list.jsp" class="at-in">
					<img src="${g.img}" class="img-responsive" alt="">
				</a>
			 </td>
			<td class="t-data">${g.goodname}</td>
			<td class="t-data">${g.goodbn}</td>
			<td class="t-data">${g.price}</td>
			<td class="t-data" id="discount">${g.disount}</td>
			<td class="t-data">
			<div class="quantity"> 
								<div class="quantity-select">            
									<div class="entry value-minus">&nbsp;</div>
										<div class="entry value"><span class="span-1">1</span></div>									
									<div class="entry value-plus active">&nbsp;</div>
								</div>
							</div>
			
			</td>
			<td class="t-data" id="total">￥200</td>		
		  </tr>
		  </c:forEach>
		</table>
			<div class=" cart-total">	
			 <a href="https://auth.alipay.com/login/index.htm">结算</a>
			 <a href="list.jsp">返回</a>			 
		</div>
	 </div>
</div>
		 	<!--quantity-->
			<script>
			$('.value-plus').on('click', function(){
				var divUpd = $(this).parent().find('.value'), newVal = parseInt(divUpd.text(), 10)+1;
				divUpd.text(newVal);
				var discount = $('discount').text();
				var total = discount*newVal;
			
				$('#total').text("￥"+total);	
			});

			$('.value-minus').on('click', function(){
				var divUpd = $(this).parent().find('.value');
				var newVal = parseInt(divUpd.text(), 10)-1;
				if(newVal>0)
				{ 
				divUpd.text(newVal);
				var discount = $('discount').text();
				var total = discount*newVal;
				
				$('#total').text("￥"+total);}
			});
			
			</script>
			<!--quantity-->	
</body>
</html>